package com.ruoyi.youtian.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.gzmx_tag.domain.Gzmx_tag;
import com.ruoyi.gzmx_tag.service.IGzmx_tagService;
import com.ruoyi.youtian.domain.PointEquipmentVo2;
import com.ruoyi.youtian.service.IScdwDeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 设备与生产点位关系
 *
 * @author ruoyi
 * @date 2022-09-16
 */
@RestController
@RequestMapping("/youtian/scdwDevice")
public class ScdwDeviceController extends BaseController
{

    @Autowired
    private IGzmx_tagService gzmx_tagService;

    @Autowired
    private IScdwDeviceService iScdwDeviceService;

    /**
     * 采集数据点位绑定设备
     * @param pointEquipmentVo
     * @return
     */
    @ResponseBody
    @PostMapping("/bound")
    public AjaxResult scdwDeviceBound(@RequestBody PointEquipmentVo2 pointEquipmentVo){
        int i = iScdwDeviceService.scdwDeviceBound(pointEquipmentVo);
        return AjaxResult.success(i);
    }

    /**
     *采集数据点位解绑定设备
     * @param pointEquipmentVo
     * @return
     */
    @ResponseBody
    @PostMapping("/unbound")
    public AjaxResult scdwDeviceUnbound(@RequestBody PointEquipmentVo2 pointEquipmentVo){
        int i = iScdwDeviceService.scdwDeviceBound(pointEquipmentVo);
        return AjaxResult.success(i);
    }


    /**
     * 基础管理 未绑定设备的点位列表
     * @param gzmx_tag
     * @return
     */
    @PostMapping("/unboundDeviceTaglist")
    @ResponseBody
    public AjaxResult  unboundDeviceTaglist(Gzmx_tag gzmx_tag){
        return  AjaxResult.success(gzmx_tagService.unboundDeviceTaglist(gzmx_tag));
    }


    /**
     * 查询该生产点位下 采集点位列表
     * @param gzmx_tag
     * @return
     */
    @PostMapping("/taglist")
    @ResponseBody
    public AjaxResult taglist(Gzmx_tag gzmx_tag){
        return  AjaxResult.success(gzmx_tagService.unboundDeviceTaglist(gzmx_tag));
    }
}
